package com.RecipeBook.Logger;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;

public class EventLogger 
{
	static String logURL = "http://www.csl.mtu.edu/~jpking/logger.php";
	public static void sendLog(String log)
	{
		URL url;
		try 
		{
			log = log.replaceAll(" ", "%20");
			url = new URL(logURL + "?message=" + log);
			
			BufferedReader in = new BufferedReader(
						new InputStreamReader(
						url.openStream()));

			String inputLine;

			while ((inputLine = in.readLine()) != null)
			    System.out.println(inputLine);

			in.close();
		} catch (MalformedURLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
